﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data.Mapping {
	public partial class TopicGroupMap : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<TopicGroup> {
		public TopicGroupMap() {
			ToTable("mc_TopicGroup", "dbo");

			HasKey(t => t.Id);
			Property(t => t.Id)
				.HasColumnName("Id")
				.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
				.IsRequired();
			Property(t => t.TopicId)
				.HasColumnName("TopicId")
				.IsRequired();
			Property(t => t.ShowImages)
				.HasColumnName("ShowImages")
				.IsRequired();
			Property(t => t.Name)
			   	.HasColumnName("Name")
				.IsOptional();

			// Relationships
			HasRequired(t => t.Topic)
				.WithMany(t => t.TopicGroups)
				.HasForeignKey(d => d.TopicId)
				.WillCascadeOnDelete(false);
		}
	}
}
